home *** CD-ROM | disk | FTP | other *** search
- Path: cscsun3.larc.nasa.gov!hook
- From: hook@cscsun3.larc.nasa.gov (Ed Hook)
- Newsgroups: comp.lang.c
- Subject: Re: Q.: How does strtol() handles overflows?
- Date: 9 Jan 1996 21:20:14 GMT
- Organization: CSC/NASA Langley Research Center
- Distribution: world
- Message-ID: <4cum6e$6st@reznor.larc.nasa.gov>
- References: <4cuc2h$gup@news.netvision.net.il>
- Reply-To: hook@cscsun3.larc.nasa.gov
- NNTP-Posting-Host: cscsun3.larc.nasa.gov
-
- In article <4cuc2h$gup@news.netvision.net.il>, simchoni@netvision.net.il (Ami Simchoni) writes:
- |> Hi,
- |>
- |> I am trying to make a rubust ascii-to-decimal function which handles
- |> input errors and overflows. I want to rely on the standard library as
- |> much as possible.
- |>
- |> Borland C++ 3.1 and 4.02 doumentation says if an overflow occurs strtol
- |> just returns zero - which is not satisfactory, of course.
- |>
- |> The BC++3.1 library source which I have, however, sets errno to ERANGE
- |> and returns LONG_MIN or LONG_MAX on overflow. This appears both in the
- |> code and in the comments.
- |>
- |> Does anybody know what the standard says about it?
- |>
- The Standard requires the behavior that you discovered in the source
- for the library.
-
- |> Thanks,
- |> Uri.
- |>
-
- --
- Ed Hook | Coppula eam, se non posit
- Computer Sciences Corporation | acceptera jocularum.
- NASA Langley Research Center | Me? Speak for my employer?...<*snort*>
- Internet: hook@cscsun3.larc.nasa.gov | ... Get a _clue_ !!! ...
-